"""
URL configuration for devops project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from myapp import views
from django.urls import include, path, re_path
from news import news_views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('myapp/',include('myapp.urls')),           #设置url路径myapp下的子路径，调用myapp模块内urls文件下的路由
    re_path('^$',views.login),                      #当url不设置路径，在根目录下，调用views的hello方法
    re_path('articles/([0-9]{4})/',views.login),  #使用正则表达式设置四位数的数字，调用的是views的archive方法


    re_path('login/$', views.login, name='login'),
    re_path('main/$', views.main, name='main'),
    re_path('news/$',news_views.json,name='news')
]
